package com.ymttest.database.sqlwapper.shenqi;

import java.util.ArrayList;
import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.shenqi.SqliveOrderDetail;

public class SqliveOrderDetailWrapper {

	SqlManager manager;

	public SqliveOrderDetailWrapper() {
		manager = new SqlManager("liveorder");
	}

	@SuppressWarnings("unchecked")
	public SqliveOrderDetail selectByPrimaryKey(long id) {

		SqliveOrderDetail sqliveOrderDetail = new SqliveOrderDetail();
		List<SqliveOrderDetail> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.shenqi.SqliveOrderDetailMapper.selectByPrimaryKey",
						id);
		manager.commit();

		if (result.size() > 0) {
			sqliveOrderDetail = result.get(0);
		}

		return sqliveOrderDetail;
	}
	
	@SuppressWarnings("unchecked")
	public List<SqliveOrderDetail> selectByOrderId(long orderId) {

		List<SqliveOrderDetail> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.shenqi.SqliveOrderDetailMapper.selectByOrderId",
						orderId);
		manager.commit();

		if (result.size() > 0) {
			return result;
		}

		return new ArrayList<SqliveOrderDetail>();
	}

	public static void main(String[] args) {
		
		SqliveOrderDetailWrapper wrapper = new SqliveOrderDetailWrapper();
		
		System.out.println(wrapper.selectByOrderId(11747418699L).get(0).getId());
	}
}
